From: Mathieu Gagne Date: Tue, 17 Apr 2012 18:13:52 +0000 (+0100) Subject: xl: xl network-attach -N (dry run) option X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0fc13df6b8cacc09bc25660915ff3fb716535d0a;p=xen.git xl: xl network-attach -N (dry run) option Add dryrun for testing and debugging purposes. Signed-off-by: Mathieu Gagne Acked-by: Ian Campbell Acked-by: Stefano Stabellini --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 4febe25cb6..5703512d24 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4916,6 +4916,16 @@ int main_networkattach(int argc, char **argv) return 1; } } + + if (dryrun_only) { + char *json = libxl_device_nic_to_json(ctx, &nic); + printf("vif: %s\n", json); + free(json); + libxl_device_nic_dispose(&nic); + if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); } + return 0; + } + if (libxl_device_nic_add(ctx, domid, &nic)) { fprintf(stderr, "libxl_device_nic_add failed.\n"); return 1; diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index f461a2a1b5..736a8366ed 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -288,7 +288,7 @@ struct cmd_spec cmd_table[] = { "", }, { "network-attach", - &main_networkattach, 0, + &main_networkattach, 1, "Create a new virtual network device", " [type=] [mac=] [bridge=] " "[ip=] [script=